<html>
<head><meta charset="utf-8"><title>Datalog/DataFrog in Rust · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Datalog.2FDataFrog.20in.20Rust.html">Datalog/DataFrog in Rust</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228461593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Datalog/DataFrog%20in%20Rust/near/228461593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Datalog.2FDataFrog.20in.20Rust.html#228461593">(Mar 02 2021 at 18:34)</a>:</h4>
<p>I'm trying to build a Datalog-based query system in Rust. I found the <code>rust-lang/datafrog</code> crate, but I'm not sure if that's the right fit, since I want users to be able to type in custom Datalog code. Am I correct that it's not meant for users to directly interact with, or if I provide a parser will I be able to get it working? Thanks!</p>



<a name="228461863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Datalog/DataFrog%20in%20Rust/near/228461863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Datalog.2FDataFrog.20in.20Rust.html#228461863">(Mar 02 2021 at 18:36)</a>:</h4>
<p>you might want to talk to <span class="user-mention" data-user-id="270600">@Chase Wilson</span>, I think he works on datalog</p>



<a name="228462052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Datalog/DataFrog%20in%20Rust/near/228462052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Datalog.2FDataFrog.20in.20Rust.html#228462052">(Mar 02 2021 at 18:37)</a>:</h4>
<p>I know <em>WG-polonius</em> uses DataFrog, so they might know too, but I don't want to ping them unnecessarily :)</p>



<a name="228463844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Datalog/DataFrog%20in%20Rust/near/228463844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Domenic Quirl <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Datalog.2FDataFrog.20in.20Rust.html#228463844">(Mar 02 2021 at 18:48)</a>:</h4>
<p>AFAIK datafrog is an implementation that was put together specifically in the context of polonius. That's not to say it is bad or you shouldn't use it, just as context and idk how "complete" it is w.r.t. to the underlying theory. <br>
Regarding alternative options, it depends a bit on how low- or high-level you want to go. There is <a href="https://docs.rs/timely/0.11.1/timely/">https://docs.rs/timely/0.11.1/timely/</a>, which is what a lot of the other implementations build on and which you could use directly. Or you could use <a href="https://docs.rs/differential-dataflow/0.11.0/differential_dataflow/">https://docs.rs/differential-dataflow/0.11.0/differential_dataflow/</a>, which is one of the things built on top. On the declarative side for actual datalog there is <a href="https://github.com/vmware/differential-datalog">https://github.com/vmware/differential-datalog</a>, which has its own compiler that generates Rust code, and <a href="https://docs.rs/crepe/0.1.5/crepe/">https://docs.rs/crepe/0.1.5/crepe/</a> that I know of. The latter is a macro that lets you embed Datalog rules in Rust.</p>



<a name="228464084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Datalog/DataFrog%20in%20Rust/near/228464084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Domenic Quirl <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Datalog.2FDataFrog.20in.20Rust.html#228464084">(Mar 02 2021 at 18:49)</a>:</h4>
<p>Chase will probably be able to tell you more about how those relate and what could be most helpful to you when he gets here if you give some more context on what you're trying to achieve</p>



<a name="228464150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Datalog/DataFrog%20in%20Rust/near/228464150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Domenic Quirl <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Datalog.2FDataFrog.20in.20Rust.html#228464150">(Mar 02 2021 at 18:49)</a>:</h4>
<p>I have only dipped my toes so far :D</p>



<a name="228478225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Datalog/DataFrog%20in%20Rust/near/228478225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Datalog.2FDataFrog.20in.20Rust.html#228478225">(Mar 02 2021 at 20:18)</a>:</h4>
<p>I wonder why Datalog engines are named after French food: you mentioned <code>crepe</code> and I've heard of one called Soufflé.</p>



<a name="228491400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Datalog/DataFrog%20in%20Rust/near/228491400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chase Wilson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Datalog.2FDataFrog.20in.20Rust.html#228491400">(Mar 02 2021 at 21:43)</a>:</h4>
<p>Hello! You said you're wanting to make a query system, could you elaborate on that? If you mean queries in the way that datalog has been traditionally used, I don't think any of the mentioned crates will suit your needs, as they're all targeted at computation instead of being query DSLs.</p>
<p>In regards to options, <code>datafrog</code> probably isn't something you want to choose as it's not actively maintained (its last commit was on Mar 31, 2020) and is probably not going to be geared as a general-purpose library since it's used almost exclusively for polonius (and Frank is pretty busy with his startup). <code>crepe</code> is a good lib but I don't believe it allows dynamic compilation and it also isn't incremental, which may or may not matter to your use case. <code>ddlog</code> doesn't <em>currently</em> support dynamic compilation but the framework for it actually exists if you brought your own parser (if you choose this route I'd love to collaborate on adding it to the real deal too). DDlog is built off of <code>timely</code>/<code>differential-dataflow</code> which are libraries for data-parallel computation, they're heavily incremental and ddlog inherits that power from them. DDlog is very akin to Soufflé if you're familiar with it, however it does have the advantage of being able to use normal rust code from it. I can give more details on ddlog, timely and differential if you'd like and/or have specific questions.</p>
<p>A more specific description of what you'd like to actually achieve would be really helpful though for pointing you in the right direction</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>